<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>DOM理解</title>
</head>

<body>
    <h1>你好，世界</h1>
    <script>
        // 使用dom来输出html标签和标签文本
        var h1 = document.getElementsByTagName('h1')[0];
        console.log(h1.outerHTML);
        console.log(h1.outerText);
    </script>
</body>

</html>